using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class so_itemLongMap : EntityTypeConfiguration<so_itemLong>
    {
        public so_itemLongMap()
        {
            // Primary Key
            this.HasKey(t => new { t.DESCRIPTION, t.Average_Cost_Base_2, t.Type, t.Category, t.STATUS });

            // Properties
            this.Property(t => t.ITEM)
                .HasMaxLength(10);

            this.Property(t => t.DESCRIPTION)
                .IsRequired()
                .HasMaxLength(250);

            this.Property(t => t.BARCODE)
                .HasMaxLength(20);

            this.Property(t => t.Type)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.Category)
                .IsRequired()
                .HasMaxLength(100);

            this.Property(t => t.Default_Vendor)
                .HasMaxLength(50);

            this.Property(t => t.UNIT_OF_ORDER)
                .HasMaxLength(50);

            this.Property(t => t.UNIT_OF_SALES)
                .HasMaxLength(50);

            this.Property(t => t.STATUS)
                .IsRequired()
                .HasMaxLength(8);

            this.Property(t => t.lastpurchrec)
                .HasMaxLength(7);

            // Table & Column Mappings
            this.ToTable("so_itemLong");
            this.Property(t => t.ITEM).HasColumnName("ITEM");
            this.Property(t => t.DESCRIPTION).HasColumnName("DESCRIPTION");
            this.Property(t => t.BARCODE).HasColumnName("BARCODE");
            this.Property(t => t.Onhand).HasColumnName("Onhand");
            this.Property(t => t.Average_Cost_Base_2).HasColumnName("Average_Cost_Base_2");
            this.Property(t => t.UNIT_COST_Base_2).HasColumnName("UNIT_COST_Base_2");
            this.Property(t => t.Average_Cost_Base_1).HasColumnName("Average_Cost_Base_1");
            this.Property(t => t.Type).HasColumnName("Type");
            this.Property(t => t.Category).HasColumnName("Category");
            this.Property(t => t.Default_Vendor).HasColumnName("Default_Vendor");
            this.Property(t => t.UNIT_OF_ORDER).HasColumnName("UNIT_OF_ORDER");
            this.Property(t => t.UNIT_OF_SALES).HasColumnName("UNIT_OF_SALES");
            this.Property(t => t.FACTOR).HasColumnName("FACTOR");
            this.Property(t => t.VAT_ENABLED).HasColumnName("VAT_ENABLED");
            this.Property(t => t.STATUS).HasColumnName("STATUS");
            this.Property(t => t.lastpurchrec).HasColumnName("lastpurchrec");
        }
    }
}
